#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 1e6+10;

int mx;

struct BIT{
	int tr[N];
	void add(int x,int y){x++;for(;x < mx;x += x & -x) tr[x] += y;}
	int query(int x,int y = 0){x++; for(;x;x -= x & -x) y += tr[x];return y;}
	int qr(int x){return query(mx) - query(x);}
	void clear(){memset(tr,0,sizeof tr);}
}T[2];

int a[N],s[N],t[N],ans,n;

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin); freopen("P3760.out","w",stdout);
#endif
	n = in; for(int i = 1;i <= n;i++) a[i] = in,s[i] = s[i - 1] + a[i],mx = max(mx,s[i]);
	for(int i = 0;i < 25;i++){
		if((1 << i) > mx) break; T[0].clear(); T[1].clear(); int cc = 0; T[0].add(0,1);
		for(int j = 1;j <= n;j++){int bit = s[j] >> i & 1; cc += T[bit].qr(t[j]) + T[bit ^ 1].query(t[j]); cc &= 1; T[bit].add(t[j],1); t[j] |= bit << i;} ans |= cc << i;
	}
	printf("%d\n",ans);	
	return 0;
}
